<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Article extends Base
{
    //追加一个字段
    protected $appends = ['action'];

    // 访问器
    public function getActionAttribute() {
//        return $this->editBtn('admin.article.edit').'&nbsp;'.$this->deleteBtn('admin.article.destroy');
    }

    public function getPicAttribute()
    {
        return  config('url.domain').$this->attributes['pic'];
    }

    public static function getArticleById($id)
    {
        return self::find($id);
    }
}
